import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '留言ID',
    align:"center",
    dataIndex: 'messageId'
   },
   {
    title: '回复目标ID(可为空，表示回复主留言)',
    align:"center",
    dataIndex: 'replyToId'
   },
   {
    title: '回复人昵称',
    align:"center",
    dataIndex: 'nickname'
   },
   {
    title: '回复人邮箱',
    align:"center",
    dataIndex: 'email'
   },
   {
    title: '回复内容',
    align:"center",
    dataIndex: 'content'
   },
   {
    title: '是否管理员回复(0:否,1:是)',
    align:"center",
    dataIndex: 'isAdminReply'
   },
   {
    title: 'IP地址',
    align:"center",
    dataIndex: 'ipAddress'
   },
   {
    title: '用户代理',
    align:"center",
    dataIndex: 'userAgent'
   },
   {
    title: '状态(0:待审核,1:已发布,2:已拒绝)',
    align:"center",
    dataIndex: 'status'
   },
   {
    title: '点赞数量',
    align:"center",
    dataIndex: 'likeCount'
   },
   {
    title: '创建时间',
    align:"center",
    dataIndex: 'createdTime'
   },
   {
    title: '更新时间',
    align:"center",
    dataIndex: 'updatedTime'
   },
   {
    title: '是否删除(0:否,1:是)',
    align:"center",
    dataIndex: 'deleted'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '留言ID',
    field: 'messageId',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入留言ID!'},
          ];
     },
  },
  {
    label: '回复目标ID(可为空，表示回复主留言)',
    field: 'replyToId',
    component: 'InputNumber',
  },
  {
    label: '回复人昵称',
    field: 'nickname',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入回复人昵称!'},
          ];
     },
  },
  {
    label: '回复人邮箱',
    field: 'email',
    component: 'Input',
  },
  {
    label: '回复内容',
    field: 'content',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入回复内容!'},
          ];
     },
  },
  {
    label: '是否管理员回复(0:否,1:是)',
    field: 'isAdminReply',
    component: 'InputNumber',
  },
  {
    label: 'IP地址',
    field: 'ipAddress',
    component: 'Input',
  },
  {
    label: '用户代理',
    field: 'userAgent',
    component: 'Input',
  },
  {
    label: '状态(0:待审核,1:已发布,2:已拒绝)',
    field: 'status',
    component: 'InputNumber',
  },
  {
    label: '点赞数量',
    field: 'likeCount',
    component: 'InputNumber',
  },
  {
    label: '创建时间',
    field: 'createdTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '更新时间',
    field: 'updatedTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '是否删除(0:否,1:是)',
    field: 'deleted',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  messageId: {title: '留言ID',order: 0,view: 'number', type: 'number',},
  replyToId: {title: '回复目标ID(可为空，表示回复主留言)',order: 1,view: 'number', type: 'number',},
  nickname: {title: '回复人昵称',order: 2,view: 'text', type: 'string',},
  email: {title: '回复人邮箱',order: 3,view: 'text', type: 'string',},
  content: {title: '回复内容',order: 4,view: 'textarea', type: 'string',},
  isAdminReply: {title: '是否管理员回复(0:否,1:是)',order: 5,view: 'number', type: 'number',},
  ipAddress: {title: 'IP地址',order: 6,view: 'text', type: 'string',},
  userAgent: {title: '用户代理',order: 7,view: 'text', type: 'string',},
  status: {title: '状态(0:待审核,1:已发布,2:已拒绝)',order: 8,view: 'number', type: 'number',},
  likeCount: {title: '点赞数量',order: 9,view: 'number', type: 'number',},
  createdTime: {title: '创建时间',order: 10,view: 'datetime', type: 'string',},
  updatedTime: {title: '更新时间',order: 11,view: 'datetime', type: 'string',},
  deleted: {title: '是否删除(0:否,1:是)',order: 12,view: 'number', type: 'number',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}